package com.nanjia.boot.product.sku.model.form;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 商品库存单元(SKU)表单对象
 *
 * @author 周洋
 * @since 2025-07-10 14:15
 */
@Getter
@Setter
@Schema(description = "商品库存单元(SKU)表单对象")
public class ProductSkuForm implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "SKU主键")
    private Long id;

    @Schema(description = "所属SPU")
    @NotNull(message = "所属SPU不能为空")
    private Long spuId;

    @Schema(description = "销售价格")
    @NotNull(message = "销售价格不能为空")
    private BigDecimal price;

    @Schema(description = "成本价")
    @NotNull(message = "成本价不能为空")
    private BigDecimal costPrice;

    @Schema(description = "库存数量")
    @NotNull(message = "库存数量不能为空")
    private Integer stock;

    @Schema(description = "库存预警值")
    @NotNull(message = "库存预警值不能为空")
    private Integer stockThreshold;

    @Schema(description = "条形码")
    @Size(max = 100, message = "条形码长度不能超过100个字符")
    private String barCode;


    @Schema(description = "SKU主图")
    @Size(max = 255, message = "SKU主图长度不能超过255个字符")
    private String mainImage;

    @Schema(description = "SKU详情图")
    private String detailImages;

    @Schema(description = "状态")
    @NotNull(message = "状态不能为空")
    private Integer status;

    @Schema(description = "仓库id")
    @NotNull(message = "仓库不能为空")
    private Long warehouseId;

    @Schema(description = "计量单位：盒、箱、条，根等等")
    @NotBlank(message = "计量单位")
    private String skuMeasurement;

    /**
     * @see com.nanjia.boot.common.enums.StockFlowEnum
     */
    @Schema(description = "库存流水类型")
    @NotNull(message = "库存流水类型不能为空")
    private Integer stockFlowType;

    @Schema(description = "变动数量")
    @NotNull(message = "变动数量不能为空")
    private Integer quantity;

    private Long skuRatio;

    private String specValueIds;

    private String specValueNames;

    private String productName;
}
